package com.demo.demospringboot.dto;

import com.demo.demospringboot.entity.User;

/**
 * 登录响应DTO
 */
public class LoginResponse {

  private boolean success;
  private String message;
  private User user;
  private String token;

  public LoginResponse() {
  }

  public LoginResponse(boolean success, String message, User user, String token) {
    this.success = success;
    this.message = message;
    this.user = user;
    this.token = token;
  }

  public static LoginResponse success(String message, User user, String token) {
    return new LoginResponse(true, message, user, token);
  }

  public static LoginResponse failure(String message) {
    return new LoginResponse(false, message, null, null);
  }

  public boolean isSuccess() {
    return success;
  }

  public void setSuccess(boolean success) {
    this.success = success;
  }

  public String getMessage() {
    return message;
  }

  public void setMessage(String message) {
    this.message = message;
  }

  public User getUser() {
    return user;
  }

  public void setUser(User user) {
    this.user = user;
  }

  public String getToken() {
    return token;
  }

  public void setToken(String token) {
    this.token = token;
  }
}